<html>

  <head>
    <title>Installation</title>
  </head>

  <h2>Installation Instructions</h2>
  <hr NOSHADE SIZE=10 WIDTH=100%>

  <body>
    <form>
      <ul>
        <li><a href="#PREREQ">Install Prerequisites</a>
        <ul>
          <li><a href="#PREREQ_UBUNTU">Install prerequisites on Ubuntu</a>
          <li><a href="#PREREQ_LIKES_OF_REDHAT">Install prerequisites on RedHat, Fedora</a>
          <li><a href="#PREREQ_MACOSX">Install Prerequisites on Mac OS X</a>
        </ul>
        <li><a href="#BUILD">Build the source</a>
        <li><a href="#UPDATE_ENV">Update env with the installation path</a>
        <li><a href="#VERIFY_INSTALL">Verify the installation</a>
      </ul>

      <a name="PREREQ"><h3>Install Prerequisites</h3></a>
      <hr NOSHADE SIZE=7 WIDTH=100%>

      <p>
      XmlPlus provides <b>"simple to use"</b> C++ data-bindings for XML-Schema.<br>
      The XmlPlus tool source is built using gnu <b>automake/autoconf/libtool</b> set of tools. 
      The thirdparty tools used are  <b>xsltproc</b>(xsl transformation tool called) and <b>expat</b>(a xml parser).<br>
      These tools are typically already present on most Linux distributions. 
      If they are not available on your system, you would need to get them before proceeding on installations.

      <ul>
        <li><a>automake/autoconf/libtool</a>
        <li><a>expat</a>
        <li><a>xsltproc</a>
      </ul>  

      Please read the OS specific subsections to find how to install the prerequisites.
      </p>

      <br>
      <a name="PREREQ_UBUNTU"><h4>Install prerequisites on UBuntu</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>

      <ol>
        <li> If not already installed, install automake, autoconf, libtool
        <br>
        <code>$ sudo apt-get install automake autoconf libtool</code>
        <br> <br>
        <li>If not already installed, install xsltproc and expat
        <br>
        <code>$ sudo apt-get install xsltproc libexpat1</code><br>
      </ol>  

      <a name="PREREQ_LIKES_OF_REDHAT"><h4>Install prerequisites on Redhat, Fedora etc.</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>

      <ol>
        <li> If not already installed, install automake, autoconf, libtool
        <br>
        <code>$ sudo yum install automake autoconf libtool</code>
        <br><br>
        <li> If not already installed, install xsltproc, expat
        <br>
        <code>$ sudo yum install xsltproc libexpat1</code><br>
      </ol>

      <a name="PREREQ_MACOSX"><h4>Install prerequisites on Mac OS X</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>

      <ol>
        <li> If not already installed, install automake, autoconf, libtool
        <br>
        <code>$ sudo port install automake autoconf libtool</code><br>
        <br>
        <strong>Note:</strong> on Mac OS X, there is a binary named <b>libtool</b>, which is different from what we need.
        On Mac OSX, We need <b>glibtool</b>, which is exactly what the port install of libtool would bring.
        <br><br>
        <li> If not already installed, install xsltproc, expat
        <br>
        <code>$ sudo port install xsltproc</code><br>
        <code>$ sudo port install libexpat1</code><br>
      </ol>
      <br><br>

      <a name="BUILD"><h3>Build the source</h3></a>
      <hr NOSHADE SIZE=7 WIDTH=100%>
      Once you are done with installation of prerequisites on your system, go through following steps:
      <ol>
        <li> if you want the build to be installed in /usr/local/ path <br>
        <code>$ ./configure </code><br>
        The configure script generates Makefile.<br>

        <br>
        Alternatively, if you want the build to be installed in user defined path <br>
        <code>$ ./configure --prefix=/path/of/installation </code><br>
        For example:<br>
        <code>$ ./configure --prefix=$HOME/xplusbuild </code><br>

        <br>
        <li>$ make &amp;&amp; make install <br>
        This will build and install the build in the sepecified installation path.
      </ol>

      If the configure script didn't work or is missing, run autogen.sh, followed by "make &amp;&amp; make install".<br>
      Later, in general, you don't have to run configure again. (unless for example, you want to change the installation path).
      <br>

      <br><br>
      <a name="UPDATE_ENV"><h3>Update env with the installation path</h3></a>
      <hr NOSHADE SIZE=7 WIDTH=100%>

      Register the installation path with the system environment.<br>
      <code>
        $ export PATH=$PATH:/path/of/installation/bin <br>  
        $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/of/installation/lib
      </code>

      <br><br>
      For example:<br>
      <code>
        $ export PATH=$PATH:$HOME/xplusbuild/bin <br>  
        $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/xplusbuild/lib
      </code>

      <br><br>  
      <strong>Note:</strong>On Mac OS X, however, you would need to export DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH.<br>
      <code>
        $ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/path/of/installation/lib <br>  
      </code>

      <br><br>
      <a name="VERIFY_INSTALL"><h3>Verify the installation</h3></a>
      <hr NOSHADE SIZE=7 WIDTH=100%>
      <p>
      Once you have installed the <b>XmlPlus</b> tool, the libraries and the binaries must be in LD_LIBRARY_PATH and PATH respectively.
      Assuming that you have installed the build in the path <i>$HOME/xplusbuild/</i>, let us peek into the installation. 
      </p>
      <br>

      Some directories inside installation path:<br>
      <code>
        [~/xplusbuild] $ ls -1<br>
        bin<br>
        include<br>
        lib<br>
      </code>

      <br>
      Some of the installed binaries:<br>
      <code>
        [~/xplusbuild] $ ls -1 bin/<br>
        domParser<br>
        xsd2cpp<br>
      </code>

      <br>
      Some of the installed headers:<br>
      <code>
        [~/xplusbuild] $ ls -1 include/<br>
        DOM<br>
        Poco<br>
        XPlus<br>
        XSD<br>
      </code>

      <br>
      Some of the installed shared libraries:<br>
      <code>
        [~/xplusbuild] $ ls -1 lib/ | grep "so$" <br>
        libdom.so<br>
        libpoco.so<br>
        libxplus.so<br>
        libxsdall.so<br>
        libxsd.so<br>
      </code>

      <br>
      The static libraries:<br>
      <code>
        [~/xplusbuild] $ ls -1 lib/ | grep "\.a$" <br>
        libdom.a <br>
        libpoco.a <br>
        libxplus.a <br>
        libxsd.a <br>
        libxsdall.a <br>
      </code>

      <br><br>
      Now, try accessing the xsd2cpp tool:
      <br>
      <code>
        $ xsd2cpp <br> 
        Usage: xsd2cpp    xsd-file    [outdir] <br>
      </code>

      <br>
      If you reached here fine, then you have finished the installation part.
      If faced problems, send us an email mentioning the details of installation problems.
      (see <a href="support.html#UPDATE_ENV">Report Bugs</a>)

    </form>
  </body>

</html>
